#!/usr/bin/python

import sys
import re

words = []
features = {}

for line in sys.stdin:
	preprocessed = re.sub('\`|\!|\'|\"|\#|\$|\%|\^|}|{|;|\.|\,|:|\[|\]|\(|&|\)|(\\\)|\/|\+|\?|\-|\=|\~|\*|\@|\|',' ',line)
	for word in preprocessed.split():
		words += [word]
		
for word in words:
	if len(word) > 3:
		feature_lst = []+[word]+[word[0:2]]+[word[0:3]]+[word[-2:]]+[word[-3:]] # Take needed features: length 5
	elif len(word) == 3:
		feature_lst = []+[word]+[word[0:2]]+[word[-2:]] # length 3
	else:
		feature_lst = []+[word] # length 1
	label = 0
	for ch in word:
		if not ch.isdigit() and ch.isupper():
			label = 1
			break
	for feature in feature_lst:
		print feature.lower() + "\t1 " + str(label)
	
